package com.season.act;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;

public class TestAct {

    //生成工作流的表
    public  void  createTable(){
        ProcessEngineConfiguration configuration =
                ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
        //设置数据库的4个属性
        configuration.setJdbcDriver("com.mysql.jdbc.Driver");
        configuration.setJdbcUrl("jdbc:mysql://localhost:3306/db_activiti?characterEncoding=utf-8");
        configuration.setJdbcUsername("root");
        configuration.setJdbcPassword("123123");
        //设置支持表的更新
        configuration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
        //得到流程引擎对象
        ProcessEngine processEngine = configuration.buildProcessEngine();

    }

    public void createTableWithXML(){
        //加载配置
        ProcessEngineConfiguration configuration =
                ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml");
        //得到工作流引擎对象
        ProcessEngine processEngine = configuration.buildProcessEngine();
    }

    public static void main(String[] args) {
        TestAct testAct=new TestAct();
        //testAct.createTable();
        testAct.createTableWithXML();
    }
}
